package com.uphone.kingmall.activity.order;

import android.graphics.Bitmap;
import android.view.View;
import android.widget.ImageView;

import com.china.zhuoyue.R;
import com.google.zxing.WriterException;
import com.uphone.kingmall.base.BaseActivity;
import com.uphone.kingmall.utils.ConstansUtils;
import com.uphone.kingmall.utils.DensityUtil;
import com.uphone.kingmall.utils.QRCodeUtils;
import com.uphone.kingmall.utils.intent.IntentData;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * <pre>
 *     author : 王雨
 *     e-mail :
 *     time   : 2018/07/31
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class OrderCodeActivity extends BaseActivity {
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.iv_invite_code)
    ImageView ivInviteCode;
    @IntentData
    private String checkCode = "";

    @Override
    public int getLayoutContentId() {
        return R.layout.kingmall_activity_order_code;
    }

    @Override
    public void initView() {
        setStatusBar();
    }

    @Override
    public void initData() {
 /*
        绘制二维码
         */
        try {
            Bitmap bitmap = QRCodeUtils.createQRCode
                    (ConstansUtils.QRCodeOrderCheck + checkCode, DensityUtil.dip2px(OrderCodeActivity.this, 260));
            ivInviteCode.setImageBitmap(bitmap);
        } catch (WriterException e) {
            e.printStackTrace();
        }
    }


    @OnClick({R.id.iv_back})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                onBackPressed();
                break;
        }
    }
}
